<?php

namespace App\Models\OpenShop\Shop;

use App\Models\BaseModel;
use App\Models\OpenShop\InvestmentPromotion\OpenShopMainProcessModel;
use App\Models\OpenShop\InvestmentPromotion\OpenShopUserContractModel;
use App\Models\Workflow\WorkflowOrderModel;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\HasOne;

class OpenShopHandleExpireShopMainModel extends BaseModel
{
    use HasFactory;


    protected $table = "open_shop_handle_expire_shop_main";

    protected $fillable = [
        "orderNo",
        "shopCode",
        "workOrderNo",
        "contractEndTime",
        "createdAt",
        "userContractId",
        "shopId",
        "contractStartTime"
    ];

    const FLOW_NODE_1    = 1;
    const FLOW_NODE_2    = 2;
    const FLOW_NODE_3    = 3;
    const FLOW_NODE_4    = 4;
    const FLOW_NODE_5    = 5;
    const FLOW_NODE_TEXT = [
        self::FLOW_NODE_1 => "待提交",
        self::FLOW_NODE_2 => "待初审",
        self::FLOW_NODE_3 => "待复审",
        self::FLOW_NODE_4 => "待签署",
        self::FLOW_NODE_5 => "已完成",
    ];

    /**
     * @return HasOne
     */
    public function mainProcessRel(): HasOne
    {
        return $this->hasOne(OpenShopMainProcessModel::class, "orderNo", "orderNo");
    }

    /**
     * @return HasOne
     */
    public function workflowOrderRel(): HasOne
    {
        return $this->hasOne(WorkflowOrderModel::class, "workflowNo", "workOrderNo");
    }
}
